//
//  YeeShopToolBottomView.m
//  YeeShopProject
//
//  Created by CoderYee on 2017/3/3.
//  Copyright © 2017年 CoderYee. All rights reserved.
//

#import "YeeShopToolBottomView.h"

@implementation YeeShopToolBottomView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame])
    {
        [self setBackgroundColor:xBackgroundColor];
        [self addButtonViews];
        [self bindViewModel];
    }
    return self;
}
-(void)addButtonViews
{
    CGFloat btnW = 100;
    CGFloat btnH = 40;
    CGFloat margin = 0;
    //加入购物车按钮
    CGFloat aX = kMainScreenWidth - btnW;
    UIButton* aBtn = [[UIButton alloc] init];
    aBtn.frame = CGRectMake(aX, 0, btnW, btnH);
    [aBtn setTitle:@"加入购物车" forState:UIControlStateNormal];
    [aBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    aBtn.backgroundColor = RGB(250, 63.0, 51.0);
    [aBtn addTarget:self action:@selector(clickButton:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:aBtn];
    
    //立即购买按钮
    CGFloat bX = kMainScreenWidth - 2*btnW - margin;
    UIButton* bBtn = [[UIButton alloc] init];
    bBtn.frame = CGRectMake(bX, 0, btnW, btnH);
    [bBtn setTitle:@"立即购买" forState:UIControlStateNormal];
    [bBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    bBtn.backgroundColor = RGB(0.0, 162.0, 154.0);
    [bBtn addTarget:self action:@selector(clickButton:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:bBtn];
    

}
-(void)bindViewModel
{
    _clickSubject=[RACSubject subject];
    
}
-(void)clickButton:(UIButton *)sender
{
    [_clickSubject sendNext:@"1"];
    
}
@end
